package com.ipoint.intr.smartCatalog.model.template;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.ManyToOne;

import org.hibernate.validator.NotNull;
import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Role;

import com.ipoint.intr.smartCatalog.model.BaseObject;

@Entity
@Name("attribute")
@Inheritance(strategy = InheritanceType.JOINED)
@Role(name = Attribute.EDIT_ATTRIBUTE_NAME, scope = ScopeType.CONVERSATION)
public class Attribute extends BaseObject {
	public static final String EDIT_ATTRIBUTE_NAME = "editAttribute";
	
	@ManyToOne
	private AttributeType attributeType;

	@ManyToOne(fetch = FetchType.EAGER)
	private Template template;

	@NotNull
	private String name;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Template getTemplate() {
		return template;
	}

	public void setTemplate(Template template) {
		this.template = template;
	}

	public AttributeType getAttributeType() {
		return attributeType;
	}

	public void setAttributeType(AttributeType attributeType) {
		this.attributeType = attributeType;
	}
}
